package com.design_patterns.interpreter;

/**
 * @author: 李德才
 * @description:
 * @create: 2020-09-20 17:55
 **/
public class Main {

    public static void main(String[] args) {
        orRelationship();
        andRelationship();
    }


    public static void orRelationship() {
        Expression robert = new TerminalExpression("Robert");
        Expression john = new TerminalExpression("John");
        OrExpression orExpression = new OrExpression(robert, john);
        System.err.println(orExpression.interpret("John"));
    }

    public static void andRelationship() {
        Expression julie = new TerminalExpression("Julie");
        Expression married = new TerminalExpression("Married");
        AndExpression andExpression = new AndExpression(julie, married);
        System.err.println(andExpression.interpret("Married"));
    }


}
